<?php
    @session_start();
    include("template/head.php");
	$sqlEn = "SELECT * FROM `st_attr_sortie` WHERE id_sortie='".$_GET['id_sortie']."'";
	$obj = new Mysql ();
	$resultEn = mysql_query($sqlEn);
	$rowEn = mysql_fetch_array($resultEn);
?>
    <div class="container-fluid">
        <div class="row-fluid">
                
        <?php include("template/menu_left.php") ?>                
        <div class="span10" id="content">
            <div class="row-fluid">
			<form id="formAddIntervention" class="form-horizontal"  enctype="multipart/form-data" method="POST" action="submit/sortie/edit_sortie.php?id_article=<?php echo $rowEn['id_article'];?>">
            <!-- block -->
                <!--  ************************ ROW ************************ -->
              <div class="span12">   
                 <div class="block">
                    <div class="navbar navbar-inner block-header">
                        <div class="muted pull-left">Editer Article</div>
                        <input type="hidden" value="<?php echo $rowEn['id_sortie'] ?>" name="id_sortie" />
                        <!-- .toolbar -->
                    </div>   
                    <div class="block-content in" id="div-1">
                    
                    <div class="control-group">  
                    	
                        <label class="control-label span4" for="ref_article">Editer une sortie</label>
                          <div class="controls">
							<select class="validate[required] form-control" id="ref_article" name="ref_article" disabled>
        					<option value="<?php echo $rowEn['id_article'] ?>" style=" margin:5px; background-repeat:no-repeat; background-size: 32px 32px;
													background-image:url(article_pic/<?php echo getPhotoName($rowEn["id_article"]) ?>); padding-left:4em;"><?php echo getRefArticle($rowEn['id_article']); ?></option>
									 <?php
											$table = "SELECT DISTINCT (`ref_article`), `id_article`, `photo_name` FROM st_article ORDER BY id_article ASC;";     
											$colonne = mysql_query($table);     
											while($data = mysql_fetch_array($colonne)){
													echo '<option value="'.$data["id_article"].'" style=" margin:5px; background-repeat:no-repeat; background-size: 32px 32px;
													background-image:url(article_pic/'.$data["photo_name"].'); padding-left:4em;">'.$data["ref_article"].'</option>';
											}
									?>
							</select>	
							
                          </div>
                    </div>
                    
                    <div class="control-group">  
                        <label class="control-label span4" for="ref_article">Désignation</label>
                          <div class="controls">
							<input type="text" name="designation" value="<?php echo getDesignation($rowEn["id_article"]) ?>" class="validate[required,custom[integer]] form-control col-lg-5" placeholder="Désignation" id="designation" disabled>
                          </div>
                    </div>
                    
                    <div class="control-group">
                        <label for="comment" class="control-label span4"  for="pass1">Quantité</label>
                    	<div class="controls">
           					<input style="margin-right:2em; width:220px" type="text" value="<?php echo $rowEn["Qte"] ?>" name="qte" class="validate[required,custom[integer]] form-control col-lg-5" placeholder="Quantité" id="form-validation-field-3">
							<select id="unit" class="validate[required] form-control" name="unit" style="width:150px" disabled>
		                      <option value=""><?php echo getUnitArticle($rowEn["id_article"]) ?></option>
		                        <?php
									$table = "SELECT DISTINCT (`valeur`), `id_unite_stockage` FROM st_att_unite_stockage ORDER BY nb_pieces ASC;";     
									$colonne = mysql_query($table);     
									while($data = mysql_fetch_array($colonne)){
										echo '<option value="'.$data["id_unite_stockage"].'">'.$data["valeur"].'</option>';
									}
								?>
							</select>
                      	</div>
                    </div>
                    
                    <div class="control-group">  
                        <label class="control-label span4" for="ref_article">Unite</label>
                          <div class="controls">
                          <select class="validate[required] form-control chzn-select" id="select02" name="id_unite">
                              <option value="">Selectionner</option>
                          <?php
                            $table = "SELECT DISTINCT `raison_social`, `id_unite` FROM st_att_unite ORDER BY raison_social DESC;";     
                            $colonne = mysql_query($table);     
                            while($data = mysql_fetch_array($colonne)){
                          ?>
                            <option <?php if($data['id_unite'] == $rowEn['id_unite']) echo "selected"?> value="<?php echo $data["id_unite"]?>" style=" margin:5px; background-repeat:no-repeat; background-size: 32px 32px;
                            padding-left:4em;"><?php echo $data["raison_social"]?></option>
                            <?php }?>
                          
                          </select> 
                                      </div>
                                </div>

                    <div class="control-group">
                            <label for="comment" class="control-label span4">Date Ajout</label>
                            <div class="controls">
                              <input value="<?php echo $rowEn['last_modif']?>" type="text" data-color-format="rgb" data-color="rgb(255, 146, 180)" data-date-format="dd/mm/yyyy" name="dateAdd" id="date01" class="datepicker validate[required] form-control">
                            </div>
                        </div>   

                    <div class="control-group">
                    	<label for="comment" class="control-label span4">Note</label>
                        <div class="controls">
                        	<textarea id="comment" name="comment" placeholder="Mettez votre note ici..." class="form-control" style="width:402px;"><?php echo $rowEn['note'] ?></textarea>
                        </div>
                    </div>  
                             <!-- /.control-group -->
                    </div>
                    </div>
              </div>
            <!--  ************************ / ROW ************************  -->
            
              <div class="span12" style="margin-left:0px;">
              <div class="form-group">
                <div class="col-lg-8">
                    <input type="submit" value="Valider" class="validate[required] btn btn-primary" style="margin-bottom:1em; float: right;" name="marque_ajout">
               </div>
          </div>         
             </form>   
            </div>
          
          </div>
            <hr>
        </div>
<?php  include("template/footer_vente_achat.php") ; ?>